Green Shift: Denmark's Energy Path¶

02806 Social Data Analysis and Visualization

Authors:

  • Diogo Carvalho, s233176
  • Matteo Piccagnoni, s232713
  • Davide Giuffrida, s233204

How to read this notebook¶

The notebook is structured into key sections: Imports and Variables, 1. Motivation, 2. Basic stats, 3. Data analysis, 4. Genre, 5. Visualizations, 6. Discussion, 7. Contributions, and 8. References with the latter divided as specified in the final project overview. To address questions, we clearly repeat the question statement, include any relevant code, and then provide a concise answer, ensuring our analysis is both clear and navigable.

An example of a question structure is as follows:

  • Question or statement regarding the task
In [1]:
# here is code if any in an appropriate codeblock
# there can be multiple of these to ensure readability

Answer/Comments to the question or statement This can also have titles using ## Title to better split the different topics

This approach ensures clarity and makes it easier to navigate through our analysis, providing a direct linkage between the questions posed and our responses.

Imports and variables¶

In [2]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import plotly.express as px
from sklearn.linear_model import LinearRegression
from urllib.request import urlopen
import json
from bokeh.plotting import figure, show, output_notebook
from bokeh.models import ColumnDataSource, CustomJS
from bokeh.plotting import figure, show
from bokeh.models import ColumnDataSource, CustomJS, Slider
from bokeh.layouts import column
from bokeh.models import HoverTool
In [3]:
plt.style.use("fivethirtyeight")

plt.rcParams["font.family"] = "serif"
plt.rcParams["font.serif"] = "Ubuntu"
plt.rcParams["font.monospace"] = "Ubuntu Mono"
plt.rcParams["font.size"] = 10
plt.rcParams["axes.labelsize"] = 10
plt.rcParams["axes.labelweight"] = "bold"
plt.rcParams["xtick.labelsize"] = 8
plt.rcParams["ytick.labelsize"] = 8
plt.rcParams["legend.fontsize"] = 10
plt.rcParams["figure.titlesize"] = 12

# Renders the plot within the Jupyter notebook
output_notebook()
Loading BokehJS ...

1. Motivation¶

  • What is your dataset?

The dataset is an aggregation of data from various reputable entities including Eurostat, Statistics Denmark, Our World in Data, The World Air Quality Index Project and OECD. It integrates diverse sets of information spanning renewable energy adoption, economic impacts, policy responses, and sustainability efforts across Denmark and other countries. This multifaceted approach allows for comprehensive analyses and correlations among different topics, as the data is not confined to a single repository but is collected from multiple sources, each contributing unique insights.

  • Why did you choose this/these particular dataset(s)?

As foreign students in Denmark, gaining a deeper understanding of how the country navigates its socio-economic and environmental challenges is crucial for us. We chose datasets from Eurostat, Statistics Denmark, Our World in Data, The World Air Quality Index Project and OECD because they provide a reliable and comprehensive view not just of Denmark’s environmental policies, but also of its economic impacts and broader sustainability efforts. These datasets allow for a nuanced analysis of Denmark's strategies in renewable energy adoption alongside socio-economic indicators, offering a more holistic view of how these strategies align with or impact other sectors. This choice enables us to engage more deeply with the country’s policy landscape and informs our perspective on living and studying in an environment that prioritizes sustainability and innovation.

  • What was your goal for the end user's experience?

Our goal for the end user's experience is to create an engaging, smooth, and informative website with interactive graphs that effectively communicate our analysis of Denmark's green energy and sustainability efforts. We aim to provide users with a user-friendly interface that allows them to explore data trends, compare Denmark's performance with other European countries, understand the economic and environmental impacts of renewable energy adoption, and interact with the visualization to have a more personalized experience. We want to empower users to gain insights into Denmark's pioneering strategies for sustainable living and inspire action towards a greener future.

2. Basic stats¶

  • Write about your choices in data cleaning and preprocessing?

The data come from different and reliable sources: Our World in Data, Statistic Denmark, Eurostat, The World Air Quality Index Project and OECD.

In the data preprocessing, we integrated multiple tables to meet the requirements of the project. We filtered the data specifically for European countries, with a particular focus on Denmark. This selective approach was taken to align with our analysis and narrative, which primarily revolves around Denmark and its comparison with other European nations. The data were additional filtered based on year, starting from 2000 onwards. Certainly, this value varies from plot to plot as it is higly dependant on the available data and purpose of the plot. We will now detail some of the most relevant data cleaning procedures we have performed. You can see the precise code in later sections.

For the analysis of Denmark's GDP throughout the years we opted to show a trend line which aids the viewer in properly understanding whether this value has been really increasing or decreasing. We created this line directly from code by fitting a Linear Regression model to the data and visualizing the obtained line.

In processing the air quality table, we grouped the data by month to derive monthly averages for air quality, facilitating the creation of a line chart with a trend line. This was created in the same fashion as detailed in the previous paragraph. Furthermore, to address missing values (NaN), we used interpolation, substituting the missing values with averages from the preceding and succeeding months. Additionally, we observed a gap in the data spanning approximately five months (from June 2017 to November 2017). To solve this, we performed further interpolation for these months to ensure accurate values and achieve a smoother graph. While this procedure eliminated a small portion of data variability, it still aided in our purpose as the timespan was relatively insignifcant and the visualisation was much enhanced.

For a detailed overview of our data processing and cleaning procedures, please refer to Section 3 below.

  • Write a short section that discusses the dataset stats, containing key points/plots from your exploratory data analysis.

Our exploratory data analysis has highlighted several critical insights, particularly focusing on Denmark's environmental and energy usage trends. Here are the top three findings based on their importance and impact:

  • Section 3.1 -> significant reduction in emissions: Both Denmark and Europe have seen significant declines in greenhouse gas emissions since 2000, with Denmark's reductions being particularly pronounced due to effective environmental policies.
  • Section 3.2 -> rapid increase in renewable energy: Since 2005, there has been a substantial increase in renewable energy usage across Europe, with Denmark consistently surpassing the EU average, showcasing its commitment to sustainable energy solutions.
  • Section 3.8 -> progressive decline in CO2 emissions: Denmark has experienced a notable decrease in CO2 emissions per capita, especially from 2010, indicating the success of its aggressive environmental strategies compared to other European nations.
  • Section 3.4 -> shift towards renewables: Denmark has significantly increased its consumption of renewable sources like solar and wind, while decreasing its reliance on coal and oil, aligning with its sustainability goals.
  • Section 3.7 -> improving air quality: The trend analysis of PM10 values suggests a general improvement in Denmark’s air quality from 2014 to 2024, with a clear decreasing trend in PM10 concentrations indicating effective air quality management strategies.

These findings underscore the effectiveness of Denmark's environmental strategies and its leadership in adopting sustainable practices, setting a benchmark for global efforts in environmental stewardship and renewable energy adoption.

3. Data analysis¶

  • Describe your data analysis and explain what you've learned about the dataset. If relevant, talk about your machine-learning.

As mentioned in the previous section one of the most interesting way we have enhanced some of our visualizations was the creation of the trend line. This line was created by fitting a Linear Regression model to the data and plotting it by extrapolating its coefficients. This process was relatively straightforward and it provides us with a clear discussion point about the visualization.

Apart from the models detailed above, we have not utilized other machine learning algorithms as we did not deem them useful for our visualizations. This was also due to the fact that we have not worked with a unified dataset, but a combination of tables found from different websites. These were already quite specific so no further data analysis was required. We instead decided to focus primarily on the combination of said tables and the quality of the plots themselves.

3.1 Greenhouse gas emissions by country¶

In this subsection, we will explore the greenhouse gas emissions data from different countries, focusing specifically on data from the year 2000 onwards and targeting European nations. Our analysis will begin by examining the structure and key characteristics of the dataset provided by Our World in Data.

We will conduct a detailed exploration of the data, involving filtering the dataset to concentrate on European countries, creating a pivot table to facilitate easier comparison across years, and finally, exporting the refined data for further use and analysis.

Import¶

In [4]:
df = pd.read_csv("./global_emissions_total.csv")

Understand the data¶

In [5]:
# shape
df.shape
Out[5]:
(37195, 4)
In [6]:
# columns
df.columns
Out[6]:
Index(['Entity', 'Code', 'Year',
       'Annual greenhouse gas emissions in CO₂ equivalents'],
      dtype='object')
In [7]:
# summary statistics
df.describe()
Out[7]:
Year Annual greenhouse gas emissions in CO₂ equivalents
count 37195.000000 3.719500e+04
mean 1936.000000 4.812280e+08
std 49.940635 2.347735e+09
min 1850.000000 -4.547971e+06
25% 1893.000000 1.890863e+06
50% 1936.000000 1.469790e+07
75% 1979.000000 7.788846e+07
max 2022.000000 5.385116e+10

Cleaning and Filtering¶

In [8]:
# filter by year >= 2000
df_from_2000 = df[df["Year"] >= 2000].reset_index(drop=True)
In [9]:
# filter by the european countries only
european_countries = [
    "Albania",
    "Andorra",
    "Armenia",
    "Austria",
    "Azerbaijan",
    "Belarus",
    "Belgium",
    "Bosnia and Herzegovina",
    "Bulgaria",
    "Croatia",
    "Cyprus",
    "Czech Republic",
    "Denmark",
    "Estonia",
    "Finland",
    "France",
    "Germany",
    "Georgia",
    "Greece",
    "Hungary",
    "Iceland",
    "Ireland",
    "Italy",
    "Latvia",
    "Liechtenstein",
    "Lithuania",
    "Luxembourg",
    "Malta",
    "Moldova",
    "Monaco",
    "Montenegro",
    "Netherlands",
    "North Macedonia",
    "Norway",
    "Poland",
    "Portugal",
    "Romania",
    "San Marino",
    "Serbia",
    "Slovakia",
    "Slovenia",
    "Spain",
    "Sweden",
    "Switzerland",
    "Turkey",
    "Ukraine",
    "United Kingdom",
    "Vatican City"
]

df_europe_from_2000 = df_from_2000[df_from_2000["Entity"].isin(european_countries)].reset_index(drop=True)
In [10]:
populations = {
    
}
In [11]:
df_europe_from_2000.head()
Out[11]:
Entity Code Year Annual greenhouse gas emissions in CO₂ equivalents
0 Albania ALB 2000 6823153.5
1 Albania ALB 2001 6972113.0
2 Albania ALB 2002 7476225.0
3 Albania ALB 2003 8287149.0
4 Albania ALB 2004 7693972.5

Pivot¶

In [12]:
df_europe_pivot_from_2000 = df_europe_from_2000.pivot(
  index='Entity',
    columns='Year',
    values='Annual greenhouse gas emissions in CO₂ equivalents',
)
df_europe_pivot_from_2000 = df_europe_pivot_from_2000.reset_index()

df_europe_pivot_from_2000.head()
Out[12]:
Year Entity 2000 2001 2002 2003 2004 2005 2006 2007 2008 ... 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022
0 Albania 6823153.5 6972113.0 7476225.00 8287149.0 7693972.5 9062968.0 8137700.00 8959703.0 9551439.0 ... 9441338.00 10226878.0 9166668.0 8819070.00 9530445.0 8901102.0 8549947.0 8438481.0 8077409.00 8034590.50
1 Andorra 679078.7 680339.9 689972.25 695759.0 722838.4 739627.1 704623.06 694276.6 688835.2 ... 604878.44 587470.0 589425.9 592965.06 589737.4 618268.0 606122.0 492249.9 484959.84 482078.66
2 Armenia 6319167.5 6965931.0 6958924.50 7462185.5 8549841.0 10663547.0 9743804.00 9629689.0 9854290.0 ... 9318625.00 9268561.0 9244813.0 9451610.00 9246954.0 9339961.0 9628735.0 10088171.0 10339451.00 9655818.00
3 Austria 75275880.0 79152790.0 80792370.00 87597544.0 86467150.0 87583040.0 85321200.00 82976936.0 82721770.0 ... 75951000.00 71922130.0 73632300.0 74552110.00 76979870.0 73716000.0 75020190.0 69069670.0 73148264.00 68350050.00
4 Azerbaijan 43875056.0 42624900.0 42571516.00 44554864.0 46609700.0 49713012.0 51107704.00 51204708.0 56980080.0 ... 57198050.00 58598628.0 60215556.0 61457564.00 59594444.0 60587220.0 66128540.0 65383680.0 69963430.00 70603160.00

5 rows × 24 columns

Per capita¶

In [13]:
# Get all the population of each country so we have per capita
url = "https://restcountries.com/v3.1/all"
response = urlopen(url)

data = response.read().decode("utf-8")

# add population to the dataframe
countries = json.loads(data)
countries_df = pd.json_normalize(countries)
countries_df = countries_df[["name.common", "population"]]

# rename the columns
countries_df.columns = ["Entity", "Population"]

# merge the dataframes
df_europe_pivot_from_2000 = pd.merge(df_europe_pivot_from_2000, countries_df, on="Entity")

# divide each column by the population except the Entity
df_europe_pivot_from_2000.iloc[:, 1:] = df_europe_pivot_from_2000.iloc[:, 1:].div(df_europe_pivot_from_2000["Population"], axis=0)

# remove last column
df_europe_pivot_from_2000 = df_europe_pivot_from_2000.iloc[:, :-1]

Export¶

In [14]:
df_europe_pivot_from_2000.to_csv("./final tables/global_emissions_europe_2000.csv", index=False)

Analysis¶

  • Avg. annual greenhouse gas emissions in Europe - Line chart
In [15]:
# Denmark 
denmark_emissions = df_europe_pivot_from_2000[df_europe_pivot_from_2000['Entity'] == 'Denmark'].drop('Entity', axis=1).T

# Calculate the average emissions per year across all European countries
average_emissions = df_europe_pivot_from_2000.drop('Entity', axis=1).mean()

fig, ax = plt.subplots(dpi=400)
average_emissions.plot(ax=ax, linewidth=2)
denmark_emissions.plot(ax=ax, linewidth=2, label='Denmark')
ax.set_title("Avg. annual greenhouse gas emissions in Europe")
ax.set_xlabel("Year")
ax.set_ylabel("Greenhouse gas emissions (in CO₂ equivalents)")
plt.legend(["Avg. Europe", "Denmark"])
plt.show()
No description has been provided for this image

Key insights:

  • Both Denmark and Europe show a decline in emissions since 2000, with Denmark having a more pronounced and consistent reduction.
  • Denmark consistently reports lower emissions than the European average, highlighting its effective environmental policies.
  • Denmark's strategies in reducing emissions, likely involving robust sustainability policies, could serve as a model for other European countries to achieve similar results.
  • Continuing current trends, Denmark could set a benchmark in sustainability, while other European countries might need to intensify their efforts to meet international climate goals.
  • Choropleth map to understand each country individually
In [16]:
df_long = df_europe_from_2000.melt(
    id_vars=["Entity", "Year"],
    value_vars="Annual greenhouse gas emissions in CO₂ equivalents",
    var_name="Metric",
    value_name="Value",
)

# load europe Geo
with urlopen(
"https://raw.githubusercontent.com/leakyMirror/map-of-europe/master/GeoJSON/europe.geojson"
) as response:
    europe_geo = json.load(response)


# Assuming df_long is already created and formatted correctly
fig = px.choropleth_mapbox(
    df_long,
    locations="Entity",
    color="Value",
    animation_frame="Year",
    hover_name="Entity",
    range_color=[df_long["Value"].min(), df_long["Value"].max()],
    mapbox_style="carto-positron",
    color_continuous_scale="Viridis",
    geojson=europe_geo,
    featureidkey="properties.NAME",
    center={"lat": 51.1657, "lon": 10.4515},
    zoom=2,
    labels={"Value": "CO₂"},
)
fig.update_layout(
    title={
        "text": "Annual greenhouse gas emissions CO₂ equivalents",
        "y": 0.97,
        "x": 0.5,
        "xanchor": "center",
        "yanchor": "top",
    },
)

# Show the figure
# fig.show()
fig.show(renderer='notebook')

Key insights:

  • There is an overall reduction in emissions across many European countries from 2000 to 2022. This change is consistent with global efforts to reduce greenhouse gas outputs in response to climate change concerns.
  • In 2000, countries like Germany, the UK, and France showed relatively higher emissions, indicated by darker shades on the map. By 2022, these countries exhibit lighter shades, indicating a significant reduction in emissions.
  • The maps suggest that European environmental policies and initiatives such as the European Green Deal may be having a positive impact, but the variation in emission levels across the continent underscores the need for more unified and stringent enforcement.

3.2 Share of energy from renewable sources¶

This subsection analyzes the share of energy from renewable sources in European countries, using data from Eurostat. Our focus is on trends from 2005 to present, emphasizing the growth in renewable energy adoption. The analysis includes data preparation, enhanced visualizations, and integration of country-specific information. This provides a clear view of each country's progress towards sustainable energy goals.

Import¶

In [17]:
df_eurostat = pd.read_excel(
    "./renewable_energy_stats.xlsx", sheet_name="Table 1", skiprows=3
)

Understand the data¶

In [18]:
df_eurostat.head()
Out[18]:
Unnamed: 0 Unnamed: 1 2004 2005 2006 2007 2008 2009 2010 2011 ... 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022
0 NaN EU 9.604989 10.181582 10.778381 11.748671 12.551783 13.850348 14.405324 14.546641 ... 16.659094 17.415867 17.819696 17.978481 18.411286 19.096097 19.88704 22.037648 21.925708 23.019673
1 NaN Belgium 1.916442 2.324783 2.657943 3.140169 3.610993 4.746488 6.004215 6.302146 ... 7.671398 8.037977 8.060039 8.743748 9.135854 9.471854 9.928942 13.000248 13.006742 13.759295
2 NaN Bulgaria 9.230635 9.172932 9.415388 9.097631 10.344928 12.005282 13.927464 14.151582 ... 18.897668 18.049891 18.26111 18.760193 18.694713 20.580967 21.545489 23.319154 19.446859 19.095279
3 NaN Czechia 6.772963 7.113168 7.361807 7.895076 8.673508 9.97738 10.513249 10.945207 ... 13.927439 15.073918 15.069623 14.925639 14.798981 15.139469 16.238905 17.303447 17.670513 18.194646
4 NaN Denmark 14.839057 15.955052 16.331896 17.746679 18.542836 19.947759 21.887705 23.388698 ... 27.173444 29.309917 30.468884 31.714785 34.387382 35.159496 37.019927 31.680763 41.008859 41.601485

5 rows × 21 columns

In [19]:
# drop 1st col
df_eurostat = df_eurostat.drop(df_eurostat.columns[0], axis=1)

# drop rows after 37
df_eurostat = df_eurostat.drop(df_eurostat.index[37:])

# rename first column
df_eurostat = df_eurostat.rename(columns={df_eurostat.columns[0]: "Location"})

# remove * from names
df_eurostat["Location"] = df_eurostat["Location"].str.replace("*", "")

# replace : in values with NaN
df_eurostat = df_eurostat.replace(":", np.nan)

# chage numeric columns to float except Location
numeric_cols = df_eurostat.columns[1:]
df_eurostat[numeric_cols] = df_eurostat[numeric_cols].apply(pd.to_numeric, errors='coerce')

# use interpolation to fill missing values where possible
df_eurostat[numeric_cols] = df_eurostat[numeric_cols].interpolate(method='linear', axis=1)

# fill remaining missing values with mean for each row
df_eurostat[numeric_cols] = df_eurostat[numeric_cols].apply(lambda x: x.fillna(x.mean()), axis=1)

Complement Dataset with Country Flag¶

In [20]:
# get iso code from country name eurostat
with urlopen(
    "https://r2.datahub.io/clt98ab600006l708tkbrtzel/master/raw/data.csv"
) as response:
    countries = pd.read_csv(response)

# rename column to standardize
countries = countries.rename(columns={"Name": "Location"})

# merge the datasets
df_eurostat = pd.merge(df_eurostat, countries, on="Location", how="left")

# add the image url based on the same url + iso code
df_eurostat["ImageURL"] = (
    "https://public.flourish.studio/country-flags/svg/" + df_eurostat["Code"] + ".svg"
)

# check null
df_eurostat[df_eurostat["Code"].isnull()]

# fix the null countries
manual_mapping = {
  "Czechia": "CZ",
  "Bosnia Herzegovina": "BA",
  "North Macedonia": "MK",
  "Kosovo": "XK",
  "Moldova": "MD",
}
for key, value in manual_mapping.items():
    df_eurostat.loc[df_eurostat["Location"] == key, "Code"] = value
    df_eurostat.loc[df_eurostat["Location"] == key, "ImageURL"] = (
        "https://public.flourish.studio/country-flags/svg/" + value + ".svg"
    )
In [21]:
# convert column names to string
df_eurostat.columns = df_eurostat.columns.astype(str)
In [22]:
df_eurostat
Out[22]:
Location 2004 2005 2006 2007 2008 2009 2010 2011 2012 ... 2015 2016 2017 2018 2019 2020 2021 2022 Code ImageURL
0 EU 9.604989 10.181582 10.778381 11.748671 12.551783 13.850348 14.405324 14.546641 16.002162 ... 17.819696 17.978481 18.411286 19.096097 19.887040 22.037648 21.925708 23.019673 NaN NaN
1 Belgium 1.916442 2.324783 2.657943 3.140169 3.610993 4.746488 6.004215 6.302146 7.085930 ... 8.060039 8.743748 9.135854 9.471854 9.928942 13.000248 13.006742 13.759295 BE https://public.flourish.studio/country-flags/s...
2 Bulgaria 9.230635 9.172932 9.415388 9.097631 10.344928 12.005282 13.927464 14.151582 15.836640 ... 18.261110 18.760193 18.694713 20.580967 21.545489 23.319154 19.446859 19.095279 BG https://public.flourish.studio/country-flags/s...
3 Czechia 6.772963 7.113168 7.361807 7.895076 8.673508 9.977380 10.513249 10.945207 12.813679 ... 15.069623 14.925639 14.798981 15.139469 16.238905 17.303447 17.670513 18.194646 CZ https://public.flourish.studio/country-flags/s...
4 Denmark 14.839057 15.955052 16.331896 17.746679 18.542836 19.947759 21.887705 23.388698 25.465142 ... 30.468884 31.714785 34.387382 35.159496 37.019927 31.680763 41.008859 41.601485 DK https://public.flourish.studio/country-flags/s...
5 Germany 6.206808 7.167114 8.465976 10.038955 10.071549 10.851355 11.667219 12.470070 13.548844 ... 14.901155 14.884790 15.472277 16.660271 17.266354 19.089984 19.395216 20.796103 DE https://public.flourish.studio/country-flags/s...
6 Estonia 18.420074 17.477611 16.010976 17.138707 18.810753 23.009321 24.574737 25.515298 25.586166 ... 28.987018 29.232052 29.538084 29.969790 31.729683 30.069384 37.442303 38.471758 EE https://public.flourish.studio/country-flags/s...
7 Ireland 2.377596 2.821511 3.073498 3.496588 3.979138 5.243378 5.755323 6.604565 7.028898 ... 9.083127 9.188946 10.520308 10.941819 11.978704 16.160239 12.376080 13.107188 IE https://public.flourish.studio/country-flags/s...
8 Greece 7.161259 7.277087 7.457756 8.248712 8.183239 8.730624 10.077325 11.152675 13.741266 ... 15.690280 15.390467 17.299615 18.001024 19.632625 21.749078 22.017305 22.678068 GR https://public.flourish.studio/country-flags/s...
9 Spain 8.344547 8.444379 9.155835 9.666744 10.743936 12.957741 13.781771 13.176240 14.238858 ... 16.220963 17.014633 17.118333 17.022566 17.851832 21.219517 20.735772 22.116359 ES https://public.flourish.studio/country-flags/s...
10 France 9.318903 9.272062 8.936263 9.425507 11.188157 12.214692 12.671398 10.812880 13.239293 ... 14.803122 15.450603 15.846540 16.384391 17.174349 19.109113 19.203752 20.258764 FR https://public.flourish.studio/country-flags/s...
11 Croatia 23.403926 23.691252 22.668147 22.160989 21.985619 23.596377 25.102701 25.389113 26.757134 ... 28.968722 28.266381 27.279786 28.046905 28.465568 31.022908 31.284604 29.354190 HR https://public.flourish.studio/country-flags/s...
12 Italy 6.315924 7.549385 8.328380 9.807282 11.491511 12.775437 13.022696 12.880686 15.440646 ... 17.525500 17.414725 18.266975 17.795761 18.181258 20.358818 19.157694 19.006172 IT https://public.flourish.studio/country-flags/s...
13 Cyprus 3.071081 3.131078 3.263392 4.000635 5.130610 5.920212 6.160990 6.244568 7.110888 ... 9.902654 9.833026 10.478049 13.873003 13.777417 16.879249 19.068510 19.429299 CY https://public.flourish.studio/country-flags/s...
14 Latvia 32.794250 32.264409 31.141357 29.614983 29.811406 34.317492 30.375183 33.478066 35.708892 ... 37.538448 37.137715 39.008434 40.019004 40.928591 42.131904 42.098016 43.316056 LV https://public.flourish.studio/country-flags/s...
15 Lithuania 17.221301 16.767884 16.887442 16.481660 17.824470 19.797971 19.639479 19.943127 21.436852 ... 25.748381 25.612462 26.037929 24.694604 25.474498 26.772677 28.166294 29.599272 LT https://public.flourish.studio/country-flags/s...
16 Luxembourg 0.898586 1.401898 1.468922 2.725435 2.809081 2.928584 2.851479 2.855204 3.112370 ... 4.986972 5.363770 6.194431 8.942019 7.046256 11.699179 11.729602 14.356327 LU https://public.flourish.studio/country-flags/s...
17 Hungary 4.363730 6.931079 7.432752 8.574893 8.563772 11.673476 12.741886 13.971882 15.529864 ... 14.495074 14.376766 13.555833 12.548452 12.633814 13.850226 14.133582 15.189839 HU https://public.flourish.studio/country-flags/s...
18 Malta 0.102418 0.122679 0.149402 0.176935 0.195046 0.221049 0.978534 1.849554 2.862046 ... 5.118696 6.208099 7.219046 7.913912 8.229987 10.714031 12.671745 13.404176 MT https://public.flourish.studio/country-flags/s...
19 Netherlands 2.029659 2.478012 2.778044 3.297681 3.595743 4.265671 3.916517 4.524364 4.659302 ... 5.713941 5.846097 6.506711 7.393795 8.886147 13.998744 12.988075 14.972051 NL https://public.flourish.studio/country-flags/s...
20 Austria 22.553103 24.353409 26.276202 28.143881 28.788421 31.039475 31.205329 31.552148 32.734281 ... 33.497483 33.369693 33.136451 33.784369 33.754840 36.545341 34.572734 33.757680 AT https://public.flourish.studio/country-flags/s...
21 Poland 6.882259 6.867250 6.858591 6.902636 7.685701 8.675681 9.280512 10.336529 10.955447 ... 11.881303 11.396131 11.058586 14.935754 15.377096 16.101880 15.612930 16.872608 PL https://public.flourish.studio/country-flags/s...
22 Portugal 19.205441 19.523188 20.791558 21.906882 22.928927 24.404683 24.149934 24.602589 24.574131 ... 30.514143 30.864146 30.610610 30.202823 30.623221 33.982330 33.981975 34.676502 PT https://public.flourish.studio/country-flags/s...
23 Romania 16.810576 17.571102 17.095505 18.194596 20.203938 22.156805 22.834033 21.742980 22.825406 ... 24.785377 25.032007 24.454213 23.874693 24.289839 24.477536 23.870897 24.139593 RO https://public.flourish.studio/country-flags/s...
24 Slovenia 18.396752 19.809098 18.416332 19.675497 18.646281 20.765437 21.080720 20.936701 21.551303 ... 22.878935 21.974892 21.657516 21.378211 21.967651 25.000032 24.999720 22.937153 SI https://public.flourish.studio/country-flags/s...
25 Slovakia 6.390532 6.359702 6.583959 7.765729 7.723102 9.368239 9.099053 10.347551 10.452887 ... 12.882459 12.029103 11.464519 11.895616 16.893540 17.344659 17.419365 17.501160 SK https://public.flourish.studio/country-flags/s...
26 Finland 29.232161 28.813775 30.043017 29.561288 31.070529 31.044586 32.166312 32.531864 34.222029 ... 39.229505 38.943289 40.856746 41.184798 42.806900 43.939378 42.853914 47.885876 FI https://public.flourish.studio/country-flags/s...
27 Sweden 38.427355 39.982143 41.734171 43.224045 43.921826 47.023557 46.099388 47.632076 49.402701 ... 52.220432 52.597146 53.389755 53.916113 55.785393 60.124273 62.686419 66.001972 SE https://public.flourish.studio/country-flags/s...
28 Iceland 58.899091 60.270363 60.920707 71.924647 67.980927 70.238172 70.908962 72.297650 73.726832 ... 71.948838 75.328549 74.104086 77.173204 78.611594 83.724786 85.784751 85.784751 IS https://public.flourish.studio/country-flags/s...
29 Norway 58.416795 60.069287 60.521324 60.397639 62.003081 65.071434 61.889434 64.637714 64.931899 ... 68.545067 69.234781 70.035971 71.566186 74.405687 77.357557 74.017922 75.819815 NO https://public.flourish.studio/country-flags/s...
30 Montenegro 39.452173 35.693641 34.842346 32.925383 32.289864 39.371176 40.639825 40.647758 41.513308 ... 43.073419 41.529409 39.692538 38.800708 37.722373 43.769765 39.890815 39.943631 ME https://public.flourish.studio/country-flags/s...
31 Serbia 12.724072 14.256955 14.541514 14.327346 15.887527 21.023999 19.763478 19.118299 20.790285 ... 21.988831 21.146748 20.286859 20.319860 21.443421 26.296861 25.255114 27.076627 RS https://public.flourish.studio/country-flags/s...
32 Bosnia Herzegovina 31.829187 31.829187 31.829187 31.829187 31.829187 31.829187 31.829187 31.829187 31.829187 ... 26.606927 25.357545 23.240527 35.972197 37.453977 39.835160 36.561778 36.561778 BA https://public.flourish.studio/country-flags/s...
33 Albania 29.620475 31.367320 32.070354 32.657130 32.447898 31.436918 31.866706 31.186619 35.152094 ... 34.912716 36.953257 35.776498 36.572272 38.041973 45.014667 41.388549 44.075950 AL https://public.flourish.studio/country-flags/s...
34 North Macedonia 15.702372 16.465729 16.527265 14.975749 15.555364 17.238288 16.451352 16.407360 18.127688 ... 19.525739 18.044209 19.636385 18.178862 17.484717 19.221882 17.467971 18.681710 MK https://public.flourish.studio/country-flags/s...
35 Kosovo 20.540576 19.772814 19.511462 18.812304 18.429375 18.230109 18.229755 17.598199 18.624613 ... 18.483911 24.471953 23.081953 24.615911 24.214786 24.400828 22.140229 18.779443 XK https://public.flourish.studio/country-flags/s...
36 Moldova 7.449518 6.401902 6.960352 6.443479 6.993619 7.924039 21.369352 22.081114 24.327641 ... 26.173302 26.887645 27.835861 27.475621 23.843460 25.056794 22.202464 21.538228 MD https://public.flourish.studio/country-flags/s...

37 rows × 22 columns

Export¶

In [23]:
#  export final dataset
df_eurostat.to_csv("./final tables/eurostat_renewable_energy_cleaned.csv", index=False)

Analysis¶

  • Bar chart of each country by year in terms of share renewable energy
In [24]:
# Set colors
colors = ['#FF2700' if loc == 'Denmark' else '#008FD5' for loc in df_eurostat['Location']]

# Prepare ColumnDataSource including all years and initializing 'y'
source = ColumnDataSource(data={
    'y': df_eurostat['Location'],  # 'y' will now represent the categorical locations
    'right': df_eurostat['2022'],  # Initialize 'right' with the latest year
    'colors': colors,
    **{str(year): df_eurostat[str(year)] for year in range(2005, 2023)}  # Ensure years are strings
})

# Create a plot with horizontal orientation
p = figure(y_range=df_eurostat['Location'], title="Share of Renewable Energy Consumption",
           toolbar_location=None, tools="")

# Add a horizontal bar renderer
renderer = p.hbar(y='y', right='right', height=0.9, color='colors', source=source)

# Add HoverTool to display values on hover
hover = HoverTool(renderers=[renderer], tooltips=[
    ("Country", "@y"),  
    ("Share of Renewable Energy Consumption", "@right%")
])
p.add_tools(hover)

# Add slider to change year
slider = Slider(start=2005, end=2022, value=2022, step=1, title="Year")

# JavaScript callback function to update the 'right' values based on the slider
callback = CustomJS(args={'source': source, 'slider': slider}, code="""
    const data = source.data;
    const year = slider.value.toString();
    data['right'] = data[year];  // Update the 'right' attribute to reflect the selected year
    source.change.emit();
""")

slider.js_on_change('value', callback)

# Layout with the slider and plot
layout = column(slider, p)

# Show plot
show(layout)

Key insights:

  • There has been a general increase in renewable energy consumption across many European countries from 2005 to 2022.
  • Nordic countries like Iceland and Sweden consistently rank high in terms of renewable energy use.
  • Countries like Norway and Albania have maintained a high share of renewable energy consumption throughout the period.
  • Denmark has always been above the EU average, and has had a steady increment each year.
  • Line chart of denmark
In [25]:
denmark_all_years = df_eurostat[df_eurostat['Location'] == 'Denmark']

denmark_numeric = denmark_all_years.drop(columns=['Location', 'Code', 'ImageURL'])

# Transpose the DataFrame to get years as rows, which makes plotting easier
denmark_transposed = denmark_numeric.T

# Rename the column for clarity in plotting
denmark_transposed.columns = ['Share of Renewable Energy Consumption']

# Now plot
fig, ax = plt.subplots(dpi=400)
denmark_transposed.plot(kind='line', ax=ax, legend=False)  # Set legend to False as we have only one data series
ax.set_title("Share of Renewable Energy Consumption in Denmark")
ax.set_xlabel("Year")
ax.set_ylabel("Share of Renewable Energy (%)")

plt.show()
No description has been provided for this image

Key insights:

  • It is more clear here the steadily increase in Denmark's renewable energy consumption from 2004, starting at around 15%, and reaching above 40% by 2019.
  • Around 2019, there's a noticeable dip in the share of renewable energy. This might reflect temporary fluctuations due to the pandemic or other external factors.
  • After the dip in 2019, the share of renewable energy rebounds sharply, suggesting a quick recovery and a resilient energy strategy that supports sustainable growth.
  • The overall trend underscores Denmark's long-term commitment to increasing renewable energy usage, aligning with its environmental policies and objectives to reduce reliance on fossil fuels and combat climate change.

3.3 GDP and trend¶

In this section, we will be creating the column for the trend line of the GDP growth plot. Since the plot presents much variability it was interesting to display if the overall GDP had been growing or shrinking over the analyzed years. To do this we will display the trendline of the data which is nothing more than a simple Linear Regression applied to the entire table. We then extract the coefficients required and create a new column detailing the precise values of the fitted line for each considered period.

Import¶

In [26]:
excel_file = './GDP.xlsx'
df = pd.read_excel(excel_file)

Creating the trend line¶

In [27]:
quarters_numeric = np.arange(len(df)).reshape(-1, 1)
gdp_values = df['Economic Growth (GDP)'].values
model = LinearRegression()
model.fit(quarters_numeric, gdp_values)
fitted_gdp = model.predict(quarters_numeric)
df['Fitted GDP'] = fitted_gdp
print(df)
   Quarters  Economic Growth (GDP)  Fitted GDP
0    2010Q1                    0.9    0.324248
1    2010Q2                    0.7    0.331678
2    2010Q3                    1.6    0.339108
3    2010Q4                   -0.2    0.346538
4    2011Q1                    0.2    0.353968
5    2011Q2                    1.0    0.361398
6    2011Q3                   -1.2    0.368828
7    2011Q4                    0.8    0.376258
8    2012Q1                   -0.1    0.383688
9    2012Q2                    0.1    0.391118
10   2012Q3                    0.1    0.398548
11   2012Q4                   -0.2    0.405977
12   2013Q1                    0.6    0.413407
13   2013Q2                    0.1    0.420837
14   2013Q3                    0.6    0.428267
15   2013Q4                    0.2    0.435697
16   2014Q1                    0.3    0.443127
17   2014Q2                   -0.1    0.450557
18   2014Q3                    1.7    0.457987
19   2014Q4                    0.4    0.465417
20   2015Q1                    0.7    0.472847
21   2015Q2                    0.5    0.480277
22   2015Q3                    0.3    0.487707
23   2015Q4                    0.2    0.495137
24   2016Q1                    1.2    0.502567
25   2016Q2                    1.4    0.509997
26   2016Q3                    0.8    0.517427
27   2016Q4                    0.7    0.524856
28   2017Q1                    0.7    0.532286
29   2017Q2                    1.1    0.539716
30   2017Q3                   -0.4    0.547146
31   2017Q4                    0.8    0.554576
32   2018Q1                    0.5    0.562006
33   2018Q2                    0.5    0.569436
34   2018Q3                    0.6    0.576866
35   2018Q4                    0.5    0.584296
36   2019Q1                   -0.2    0.591726
37   2019Q2                    1.0    0.599156
38   2019Q3                    0.5    0.606586
39   2019Q4                   -0.3    0.614016
40   2020Q1                   -1.2    0.621446
41   2020Q2                   -5.9    0.628876
42   2020Q3                    5.9    0.636306
43   2020Q4                    0.7    0.643735
44   2021Q1                    1.3    0.651165
45   2021Q2                    3.2    0.658595
46   2021Q3                    1.3    0.666025
47   2021Q4                    1.9    0.673455
48   2022Q1                   -1.2    0.680885
49   2022Q2                    1.2    0.688315
50   2022Q3                    0.5    0.695745
51   2022Q4                   -0.2    0.703175
52   2023Q1                    1.3    0.710605
53   2023Q2                   -0.8    0.718035
54   2023Q3                    0.4    0.725465
55   2023Q4                    2.6    0.732895

Export¶

In [28]:
df.to_excel('./final tables/fitted-gdp.xlsx', index=False)

Analysis¶

  • Economic growth vs fitted GDP
In [29]:
fig, ax = plt.subplots(dpi=400)
df.plot(x='Quarters', y='Economic Growth (GDP)', ax=ax, label='Economic Growth (GDP)')
df.plot(x='Quarters', y='Fitted GDP', ax=ax, linestyle='--', label='Fitted GDP')
ax.set_xlabel('Year')
ax.set_ylabel('GDP')
ax.set_title('Economic Growth vs Fitted GDP')
plt.xticks(rotation=45)  # Rotate x-axis labels for better readability
plt.show()
No description has been provided for this image

Key insights:

  • The fitted GDP line (red), representing a simple linear regression, shows that over the entire period from 2010 to 2023, the general trend in economic growth has been relatively stable with a slight upward tilt. This suggests that despite fluctuations, there has been a mild positive growth trend over these years.
  • The sharp downward spike around 2020 is the most noticeable feature on the graph, where the actual GDP growth (blue line) drops significantly below the trend line. This likely corresponds to the economic impact of the COVID-19 pandemic, illustrating how extraordinary events can drastically affect economic performance.
  • After the steep decline in 2020, there appears to be a sharp recovery, as indicated by the blue line rising above the trend line immediately following the dip. This suggests a strong bounce-back in economic activity post the initial shock of the pandemic.
  • Throughout the observed period, the actual GDP growth shows considerable variability around the trend line, indicating frequent shifts in economic performance relative to the overall growth trend. This variability could be influenced by numerous factors, including policy changes, global economic conditions, and other external shocks.

3.4 Energy consumption by source¶

In this section we will obtain the table required to visualize the stacked line chart of energy consumption in Denmark by year. This plot will offer greater insight into how Danish people consume electricity and how this varies throughout the years.

When it comes to data cleaning, in this case we simply isolated Denmark as a country. We then reduced the timespan to consider only the observations after the year 2000.

Finally, we drop the "Nuclear consumption" column since the column is entirely filled with zeros. This is expected as Denmark does not own Nuclear power plants after a resolution passed in the Danish parliament forbidding their development (World Nuclear Association)

Import¶

In [30]:
df = pd.read_csv('./energy-consumption-by-source-and-country.csv')

Cleaning¶

In [31]:
df = df.loc[df['Entity'] == 'Denmark']
print(df.columns)
Index(['Entity', 'Code', 'Year',
       'Other renewables (including geothermal and biomass) - TWh',
       'Biofuels consumption - TWh', 'Solar consumption - TWh',
       'Wind consumption - TWh', 'Hydro consumption - TWh',
       'Nuclear consumption - TWh', 'Gas consumption - TWh',
       'Coal consumption - TWh', 'Oil consumption - TWh'],
      dtype='object')
In [32]:
df = df.loc[df['Year'] >= 2000]
df = df.drop(columns=['Code'])
In [33]:
print(df["Nuclear consumption - TWh"])
1685    0.0
1686    0.0
1687    0.0
1688    0.0
1689    0.0
1690    0.0
1691    0.0
1692    0.0
1693    0.0
1694    0.0
1695    0.0
1696    0.0
1697    0.0
1698    0.0
1699    0.0
1700    0.0
1701    0.0
1702    0.0
1703    0.0
1704    0.0
1705    0.0
1706    0.0
1707    0.0
Name: Nuclear consumption - TWh, dtype: float64
In [34]:
df.drop(["Nuclear consumption - TWh"], axis = 1, inplace = True)

Export¶

In [35]:
df.to_excel('./final tables/energy-consumption-by-source.xlsx', index=False)

Analysis¶

  • Energy consumption by category
In [36]:
# remove Other renewable (including geothermal and biomass) - TWh
df.drop(["Other renewables (including geothermal and biomass) - TWh"], axis = 1, inplace = True)
In [37]:
fig, ax = plt.subplots(dpi=400)
for column in df.columns[2:]:
    df.plot(x='Year', y=column, ax=ax, label=column)
    ax.fill_between(df['Year'], df[column], alpha=0.1)

# Set the title and labels
ax.set_title('Energy Consumption Over Time')
ax.set_xlabel('Year')
ax.set_ylabel('Consumption (TWh)')
ax.legend()
plt.show()
No description has been provided for this image

Key insights:

  • Biofuels have consistently been the most significant energy source, although there's a notable dip around 2015 before regaining and maintaining a high consumption level.
  • There has been a significant increase in solar and wind energy consumption, particularly from around 2010 onwards. This suggests a shift towards more renewable energy sources over time.
  • The consumption of coal and oil has shown a declining trend over the observed period. Coal consumption, in particular, has decreased substantially, which could be indicative of environmental policies and economic factors influencing energy source choices.
  • The consumption of hydro and gas energy sources has remained relatively stable throughout the years. Hydro energy usage has seen minimal fluctuations, while gas consumption has seen a slight increase towards the end of the period.
  • As noted, Denmark does not utilize nuclear power, which aligns with the governmental policy against the development of nuclear power plants in the country.

3.5 Energy produced by source¶

Import¶

In [38]:
df = pd.read_csv("share-energy-source-sub.csv")

Data cleaning¶

In [39]:
df = df.loc[df['Entity'] == 'Denmark']
df = df.loc[df['Year'] >= 2000]
df = df.drop(columns=['Code'])
df.reset_index(drop=True, inplace=True)
df.drop(['Nuclear (% equivalent primary energy)'], axis = 1, inplace = True)

Export¶

In [40]:
df.to_excel('share-of-energy-produced-by-source.xlsx', index=False)

Analysis¶

  • Energy produced over time
In [41]:
plt.figure(figsize=(10, 6))

for column in df.columns[2:]:
    plt.plot(df['Year'], df[column], label=column)
    plt.fill_between(df['Year'], df[column], color='red', alpha=0.1)

plt.title('Energy Produced Over Time')
plt.xlabel('Year')
plt.ylabel('Produced energy (%) by share')
plt.legend()
plt.show()
No description has been provided for this image

Key insights:¶

  • Non-renewable sources have dropped in the past 20 years, but not as significantly as one would have hoped for since oil is still the major source of energy for the country.
  • Wind is the top renewable energy source today with a share of almost 27%. On the contrary solar and hydro occupy a very small portion of the energy mix.

3.6 Greenhouse gas emissions¶

In this section, we will obtain the table required to plot greenhouse gas emissions throughout the years. This is one of the key metrics we wish to analyze as it offers great insight into how much of a change (if any) the green initiatives brought forward by Denmark are having on the environment.

Fortunately, the obtained dataset was quite clean to begin with. Here we only performed some column renaming and dropped some useless tables.

Import¶

In [42]:
df = pd.read_excel("./Greenhouse-emissions.xlsx")

Cleaning¶

In [43]:
df.drop(columns=['Bridge table for Greenhouse Gasses by bridging items, type of emission and time', 'Unnamed: 1'], inplace=True)
df.drop(0, axis=0, inplace = True)
df = df.transpose()
df = df.reset_index(drop=True)
df = df.rename(columns={1: 'Year', 2: 'Emissions'})
df = df.astype(int)
print(df)
    Year  Emissions
0   2002      78822
1   2003      83596
2   2004      77364
3   2005      72988
4   2006      80856
5   2007      76469
6   2008      71458
7   2009      67988
8   2010      67184
9   2011      61435
10  2012      56419
11  2013      57791
12  2014      54303
13  2015      50507
14  2016      53638
15  2017      51262
16  2018      53010
17  2019      48317
18  2020      45954
19  2021      46271

Export¶

In [44]:
df.to_excel('./final tables/greenhouse-emissions.xlsx', index=False)

Analysis¶

  • Emissions over time in Denmark
In [45]:
fig, ax = plt.subplots(dpi=400)
df.plot(x='Year', y='Emissions', ax=ax, label='Emissions')
ax.set_title('Emissions Over Time')
ax.set_xlabel('Year')
ax.set_ylabel('Emissions')
# Set the x-axis tick positions to be exactly the 'Year' values
ax.set_xticks(df['Year'])
# set n_ticks to 5
ax.xaxis.set_major_locator(plt.MaxNLocator(nbins=5))
plt.show()
No description has been provided for this image

Key insights:

  • There has been a clear overall decrease in emissions from the beginning of the period around 2002 until 2020. This trend suggests that Denmark's initiatives to reduce greenhouse gas emissions have been effective over the long term.
  • The emissions show some fluctuation in the early years, peaking around 2005 and again in 2007. These fluctuations could indicate variability in economic activities, energy usage, or the implementation of environmental policies during those years.
  • After the peaks in the mid-2000s, there is a more consistent and pronounced decline in emissions. This part of the graph may reflect the impact of more stringent and effectively implemented environmental policies, technological advancements in renewable energy, or changes in industrial and economic structures.
  • The decline in emissions appears to slow down and plateau towards the end of the timeline, around 2017 to 2020. This could suggest that the most easily achievable reductions have been made, and further decreases in emissions might require new technologies or more radical policy changes and innovations.

3.7 Air quality¶

In this section, we will analyze how the air quality in Denmark has been changing throughout the years. We have performed several steps to end up with the best visualization.

One of the first things we decided to do to have a cleaner visualization was aggregating monthly the data.

Afterward, we also realized that there were several months of observations missing. To address this issue we filled those values up with the interpolations between the first period before the gap and the first period after the gap which had values.

Finally, we created a trend line to better showcase if it has been decreasing or increasing. Since the data has much variance this will help out the understanding of the plot.

Import¶

In [46]:
df = pd.read_csv("./risø,-denmark-air-quality.csv")

Cleaning¶

In [47]:
df["date"] = pd.to_datetime(df["date"])
df["year"] = df["date"].dt.year
df['month'] = df['date'].dt.month
df = df.rename(columns={" pm10": 'pm10'})
df = df.sort_values(by='date')
df = df.reset_index(drop=True)
print(df)
           date  pm25 pm10   o3  no2  co  year  month
0    2013-12-31         26   14    5   1  2013     12
1    2014-01-01    77   14   13    4      2014      1
2    2014-01-02    44   10   19    4      2014      1
3    2014-01-03    19   12   30    3   1  2014      1
4    2014-01-04    25   17   23    3   1  2014      1
...         ...   ...  ...  ...  ...  ..   ...    ...
3462 2024-04-16          8   34        1  2024      4
3463 2024-04-17          7   37    1   1  2024      4
3464 2024-04-18          6   30    1   1  2024      4
3465 2024-04-19          5   26        1  2024      4
3466 2024-04-20          6                2024      4

[3467 rows x 8 columns]

Aggregating monthly and interpolating¶

In [48]:
df['pm10'] = pd.to_numeric(df['pm10'], errors='coerce')
df['pm10'] = df['pm10'].round(2)
df_monthly_mean = df.groupby(['year', 'month'])['pm10'].mean().reset_index()
df_monthly_mean.columns = ['year', 'month', 'pm10_mean']

def fill_nan_with_average(row):
    if pd.isna(row['pm10_mean']):
        prev_month_index = row.name - 1
        next_month_index = row.name + 1
        if prev_month_index >= 0 and next_month_index < len(df_monthly_mean):
            prev_month_value = df_monthly_mean.loc[prev_month_index, 'pm10_mean']
            next_month_value = df_monthly_mean.loc[next_month_index, 'pm10_mean']
            if pd.isna(next_month_value):
                next_month_value = df_monthly_mean.loc[next_month_index + 1, 'pm10_mean']
            if pd.isna(prev_month_value):
                prev_month_value = df_monthly_mean.loc[prev_month_index - 1, 'pm10_mean']
            return (prev_month_value + next_month_value) / 2
        else:
            return np.nan
    else:
        return row['pm10_mean']

df_monthly_mean['pm10_mean'] = df_monthly_mean.apply(fill_nan_with_average, axis=1)
df_monthly_mean['pm10_mean'] = df_monthly_mean['pm10_mean'].round(2)
print(df_monthly_mean)
df_monthly_mean['pm10_mean'].isna().sum()
     year  month  pm10_mean
0    2013     12      26.00
1    2014      1      13.71
2    2014      2      16.15
3    2014      3      16.00
4    2014      4      13.43
..    ...    ...        ...
113  2023     12      11.02
114  2024      1      11.65
115  2024      2       8.83
116  2024      3      11.77
117  2024      4       9.30

[118 rows x 3 columns]
Out[48]:
0
In [49]:
df = df_monthly_mean
df['year'] = df['year'].astype(str)
df['month'] = df['month'].astype(str).str.zfill(2)
df['year_month'] = df['year'] + '-' + df['month']
df = df.drop(columns=['year', 'month'])
new_column_order = ['year_month', 'pm10_mean'] + [col for col in df.columns if col not in ['year_month', 'pm10_mean']]
df = df.reindex(columns=new_column_order)
print(df)
    year_month  pm10_mean
0      2013-12      26.00
1      2014-01      13.71
2      2014-02      16.15
3      2014-03      16.00
4      2014-04      13.43
..         ...        ...
113    2023-12      11.02
114    2024-01      11.65
115    2024-02       8.83
116    2024-03      11.77
117    2024-04       9.30

[118 rows x 2 columns]
In [50]:
df['year_month'] = pd.to_datetime(df['year_month'])
df.set_index('year_month', inplace=True)
start_date = df.index.min()
end_date = df.index.max()
date_range = pd.date_range(start=start_date, end=end_date, freq='MS')
date_range_df = pd.DataFrame(date_range, columns=['year_month'])
merged_df = pd.merge(date_range_df, df, how='left', left_on='year_month', right_index=True)
merged_df.reset_index(inplace=True)
merged_df.set_index('year_month', inplace=True)
merged_df['pm10_mean'] = merged_df['pm10_mean'].interpolate(method='time', limit_direction='both')
merged_df = merged_df.interpolate(method='time', limit_direction='both')
merged_df.reset_index(inplace=True)
merged_df['pm10_mean'].isna().sum()
merged_df.drop(columns=["index"], inplace=True)
print(merged_df)
    year_month  pm10_mean
0   2013-12-01      26.00
1   2014-01-01      13.71
2   2014-02-01      16.15
3   2014-03-01      16.00
4   2014-04-01      13.43
..         ...        ...
120 2023-12-01      11.02
121 2024-01-01      11.65
122 2024-02-01       8.83
123 2024-03-01      11.77
124 2024-04-01       9.30

[125 rows x 2 columns]

Creating the trend line¶

In [51]:
df = merged_df
periods = np.arange(len(df)).reshape(-1, 1)
pm10_values = df['pm10_mean'].values
model = LinearRegression()
model.fit(periods, pm10_values)
fitted_pm10 = model.predict(periods)
df['trend'] = fitted_pm10
df = df.drop(index=0)
print(df)
    year_month  pm10_mean      trend
1   2014-01-01      13.71  13.283555
2   2014-02-01      16.15  13.252450
3   2014-03-01      16.00  13.221345
4   2014-04-01      13.43  13.190240
5   2014-05-01      12.55  13.159135
..         ...        ...        ...
120 2023-12-01      11.02   9.582051
121 2024-01-01      11.65   9.550946
122 2024-02-01       8.83   9.519841
123 2024-03-01      11.77   9.488736
124 2024-04-01       9.30   9.457631

[124 rows x 3 columns]

Export¶

In [52]:
df.to_excel('./final tables/air-quality.xlsx', index=False)

Analysis¶

  • PM10 mean and trend over time
In [53]:
df['year_month'] = pd.to_datetime(df['year_month'])

fig, ax = plt.subplots(dpi=400)
df.plot(x='year_month', y='pm10_mean', ax=ax, label='pm10_mean')
df.plot(x='year_month', y='trend', ax=ax, label='trend', linestyle='--')
ax.set_title('PM10 Mean and Trend Over Time')
ax.set_xlabel('Year-Month')
ax.set_ylabel('Values')
plt.show()
No description has been provided for this image

Key insights:

  • There's a clear decreasing trend in PM10 values over time as indicated by the red dashed line. This suggests that air quality in terms of PM10 concentration has generally been improving from 2014 to 2024.
  • The blue line, representing monthly mean PM10 values, shows significant fluctuations. These variations might be influenced by seasonal changes, environmental policies, or other factors affecting air quality on a short-term basis.
  • The periodic spikes and drops in the graph suggest possible seasonal influences on PM10 concentrations. For instance, higher values might be observed in colder months due to increased heating emissions, and lower in warmer months.
  • Even though there are occasional peaks where PM10 concentrations spike, the overall trend line continues to decline. This indicates effective long-term strategies or improvements in managing factors that contribute to PM10 emissions.

3.8 CO2 emissions per capita¶

In this section we obtain the pivoted table of CO2 emissions per capita of Denmark so that we can compare it to the world average and the European average. This will further prove the case that Denmark's investments and efforts are paying off and benchmark those values against meaningful metrics.

Import¶

In [54]:
df = pd.read_csv("./co-emissions-per-capita.csv")

Cleaning¶

In [55]:
df = df.pivot(index='Year', columns='Entity', values='Annual CO₂ emissions (per capita)')
df = df.reset_index()
df.columns.name = None
print(df)
     Year  Afghanistan    Africa   Albania   Algeria   Andorra    Angola  \
0    1750          NaN  0.000000       NaN       NaN  0.000000       NaN   
1    1760          NaN  0.000000       NaN       NaN  0.000000       NaN   
2    1770          NaN  0.000000       NaN       NaN  0.000000       NaN   
3    1780          NaN  0.000000       NaN       NaN  0.000000       NaN   
4    1790          NaN  0.000000       NaN       NaN  0.000000       NaN   
..    ...          ...       ...       ...       ...       ...       ...   
223  2018     0.294876  1.049142  1.701397  4.085100  6.592212  0.685386   
224  2019     0.293401  1.099294  1.679590  4.181610  6.333704  0.594128   
225  2020     0.305039  0.998217  1.750674  3.909925  4.808461  0.501512   
226  2021     0.306317  1.031171  1.717741  4.079527  4.592206  0.507356   
227  2022     0.295364  0.994221  1.743200  3.927226  4.617124  0.451552   

     Anguilla  Antigua and Barbuda  Argentina  ...   Uruguay  Uzbekistan  \
0         NaN                  NaN        NaN  ...       NaN         NaN   
1         NaN                  NaN        NaN  ...       NaN         NaN   
2         NaN                  NaN        NaN  ...       NaN         NaN   
3         NaN                  NaN        NaN  ...       NaN         NaN   
4         NaN                  NaN        NaN  ...       NaN         NaN   
..        ...                  ...        ...  ...       ...         ...   
223  8.677324             6.716774   4.066307  ...  1.917387    3.152217   
224  9.511942             6.959958   3.989486  ...  1.892988    3.288027   
225  9.152959             6.681802   3.705468  ...  1.888890    3.269993   
226  8.726662             6.400294   4.190760  ...  2.364734    3.414994   
227  8.752724             6.421875   4.237817  ...  2.306038    3.483060   

      Vanuatu  Venezuela   Vietnam  Wallis and Futuna     World     Yemen  \
0         NaN        NaN       NaN                NaN  0.012480       NaN   
1         NaN        NaN       NaN                NaN  0.013482       NaN   
2         NaN        NaN       NaN                NaN  0.015995       NaN   
3         NaN        NaN       NaN                NaN  0.017820       NaN   
4         NaN        NaN       NaN                NaN  0.021896       NaN   
..        ...        ...       ...                ...       ...       ...   
223  0.603874   3.377444  2.715315           2.166216  4.785001  0.376479   
224  0.541631   3.024043  3.568600           2.185599  4.770166  0.375228   
225  0.646532   2.174631  3.759417           2.196079  4.464730  0.337132   
226  0.658883   2.539488  3.617115           2.296465  4.654845  0.351344   
227  0.636305   2.716869  3.499517           2.281908  4.658219  0.337017   

       Zambia  Zimbabwe  
0         NaN       NaN  
1         NaN       NaN  
2         NaN       NaN  
3         NaN       NaN  
4         NaN       NaN  
..        ...       ...  
223  0.415980  0.711830  
224  0.421688  0.636645  
225  0.430287  0.500945  
226  0.444877  0.524972  
227  0.445701  0.542628  

[228 rows x 232 columns]

Export¶

In [56]:
df.to_excel('./final tables/co2-emissions-per-capita.xlsx', index=False)

Analysis¶

  • CO2 emissions per capita Denmark vs. Europe
In [57]:
# show from 2000-2022
df = df[df['Year'] >= 2000]

fig, ax = plt.subplots(dpi=400)
# denmark and europe
df.plot(x='Year', y='Denmark', ax=ax, label='Denmark')
df.plot(x='Year', y='Europe', ax=ax, label='Europe')

ax.set_title('CO2 Emissions Per Capita Over Time')
ax.set_xlabel('Year')
ax.set_ylabel('Consumption (TWh)')
plt.show()
No description has been provided for this image

Key insights:

  • Both Denmark and Europe show a general decreasing trend in CO2 emissions per capita from 2000 to 2022. This trend is indicative of successful environmental policies and a shift towards more sustainable energy sources.
  • Denmark's CO2 emissions per capita experienced a sharp decline starting around 2010, diverging from a previously similar trend with Europe. This suggests that Denmark might have implemented more aggressive or effective environmental policies or technologies around this time compared to the broader European measures.
  • Prior to 2010, Denmark’s CO2 emissions per capita were more volatile compared to Europe's, with noticeable peaks and troughs. This could be indicative of varying economic activities, changes in energy production methods, or adjustments in environmental policy effectiveness during those years.
  • Around 2015, the emissions curves of Denmark and Europe appear to converge and follow a similar downward trajectory, indicating that by this period, both may have aligned more closely in their environmental strategies or that broader European regulations and technologies started to have a uniform impact.

3.9 GDP per capita vs. share of renewable energy¶

In this section we will obtain the table measuring Denmark's GDP per capita in US dollars. From this table we will create a panel where we will compare the overall economy in Denmark with some green metric such as shares of renewable energy or greenhouse gas emissions.

Import¶

In [58]:
df = pd.read_excel("./GDP per capita denmark.xlsx")
print(df)
    Year GDP ($US per capita)
0   2000               28 670
1   2001               29 456
2   2002               30 640
3   2003               30 825
4   2004               32 949
5   2005               34 153
6   2006               37 336
7   2007               39 025
8   2008               41 283
9   2009               40 331
10  2010               43 001
11  2011               44 408
12  2012               44 809
13  2013               46 743
14  2014               47 905
15  2015               49 058
16  2016               51 967
17  2017               55 356
18  2018               57 479
19  2019               60 761
20  2020               62 544
21  2021               69 912
22  2022               77 915

Cleaning¶

In [59]:
df1 = pd.read_excel("./renewable_energy.xlsx")
df["Renewable energy (% of primary energy supply)"] = df1["Renewable energy (% of primary energy supply)"]
df = df.loc[df['Year'] < 2022]
df['GDP ($US per capita)'] = df['GDP ($US per capita)'].str.replace('\xa0', '')
df['GDP ($US per capita)'] = df['GDP ($US per capita)'].astype(int)
print(df)
    Year  GDP ($US per capita)  Renewable energy (% of primary energy supply)
0   2000                 28670                                           9.64
1   2001                 29456                                          10.16
2   2002                 30640                                          11.01
3   2003                 30825                                          12.00
4   2004                 32949                                          13.71
5   2005                 34153                                          15.04
6   2006                 37336                                          14.25
7   2007                 39025                                          16.18
8   2008                 41283                                          16.82
9   2009                 40331                                          17.94
10  2010                 43001                                          19.93
11  2011                 44408                                          22.15
12  2012                 44809                                          24.02
13  2013                 46743                                          24.78
14  2014                 47905                                          27.58
15  2015                 49058                                          29.38
16  2016                 51967                                          29.84
17  2017                 55356                                          32.99
18  2018                 57479                                          32.70
19  2019                 60761                                          35.67
20  2020                 62544                                          38.47
21  2021                 69912                                          40.41

Export¶

In [60]:
df.to_excel('./gdp-and-renewable-energy.xlsx', index=False)

Analysis¶

  • GDP vs. share of renewable energy
In [61]:
fig, axs = plt.subplots(1, 2, dpi=400, constrained_layout=True)

axs[0].plot(df['Year'], df['GDP ($US per capita)'], label='GDP ($US per capita)', color='#e5ae38')
axs[0].set_title('GDP Over the Years')
axs[0].set_xlabel('Year')
axs[0].set_ylabel('GDP ($US per capita)')
axs[0].legend()

axs[1].plot(df['Year'], df['Renewable energy (% of primary energy supply)'], label='Renewable Energy (%)')
axs[1].set_title('Share of RE Over the Years')
axs[1].set_xlabel('Year')
axs[1].set_ylabel('Renewable Energy (%)')
axs[1].legend()
plt.show()
No description has been provided for this image

Key insights:

  • From 2000 to 2020, Denmark’s GDP per capita nearly doubled from approximately $30,000 to almost $70,000, indicating strong economic growth.
  • The share of renewable energy in Denmark’s energy supply rose sharply from about 10% in 2000 to over 40% by 2020, demonstrating a firm commitment to renewable energy.
  • The data suggests a positive correlation between economic growth and the rise in renewable energy, indicating that Denmark's investments in renewable technologies have likely contributed to economic prosperity.
  • The acceleration in renewable energy adoption post-2010 may be attributed to advances in technology, improved policy frameworks, or a heightened global focus on climate change.
  • Denmark’s example illustrates that high levels of renewable energy adoption can coexist with robust economic growth, offering a viable model for sustainable development.

3.10 Fossil fuel share vs total energy consumed¶

Import¶

In [62]:
df = pd.read_csv("fossil-fuels-share-energy.csv")
df1 = pd.read_csv("primary-energy-cons.csv")

Data cleaning¶

In [63]:
df = df.loc[df['Entity'] == 'Denmark']
df = df.loc[df['Year'] >= 2000]
df = df.drop(columns=['Code'])
df.reset_index(drop=True, inplace=True)
In [64]:
df1 = df1.loc[df1['Entity'] == 'Denmark']
df1 = df1.loc[df1['Year'] >= 2000]
df1 = df1.drop(columns=['Code'])
df1.reset_index(drop=True, inplace=True)
df1['Primary energy consumption (TWh)'] = df1['Primary energy consumption (TWh)'].round(2)
In [65]:
df['Primary energy consumption (TWh)'] = df1['Primary energy consumption (TWh)']

Export¶

In [66]:
df.to_excel('final tables/primary-energy-consumption-vs-fossil-fuel-share.xlsx', index=False)

Analysis¶

  • Fossil Fuels vs Total Energy
In [67]:
fig, axes = plt.subplots(nrows=1, ncols=2, dpi=400)

axes[0].plot(df['Year'], df['Fossil fuels (% equivalent primary energy)'], label='Fossil fuels (% equivalent primary energy)')
axes[0].set_title('Fossil Fuels Share of Energy')
axes[0].set_xlabel('Year')
axes[0].set_ylabel('Fossil fuel share')
axes[0].legend(loc='upper center')

axes[1].plot(df1['Year'], df1['Primary energy consumption (TWh)'], label='Primary energy consumption (TWh)')
axes[1].set_title('Total Energy Consumption')
axes[1].set_xlabel('Year')
axes[1].set_ylabel('Total energy consumption (TWh)')
axes[1].legend(loc='upper center')

plt.tight_layout()

plt.show()
No description has been provided for this image

4. Genre¶

  • Which genre of data story did you use?

The genre of data story used is "Digital Magazine Style." This genre typically involves presenting data and analysis in a visually appealing and immersive manner, close to reading a magazine but in a digital format. The use of interactive charts and engaging design elements enhances the storytelling experience, allowing users to explore Denmark's energy evolution interactively and attractively.

  • Which tools did you use from each of the 3 categories of Visual Narrative (Figure 7 in Segal and Heer). Why?

The Visual Narrative's tools used are the following:

  • Consistent visual platform, to mantain a uniform design and presentation of the visual elements. It helps the audience to navigate the information more smoothly and improve the aesthetics and professionalism of the story;
  • Feature distinction, in order to highlight important aspects of the data and the visualizations;
  • Motion, to create an animated and dynamic story. It improves the storytelling experience by adding a sense of progression and changing, for example during time;
  • Animated transition, to improve user's engagement and comprehension using smooth transiction effects to highlight the differences between different stages.
  • Which tools did you use from each of the 3 categories of Narrative Structure (Figure 7 in Segal and Heer). Why?

For the Narrative Structure we used the following tools:

  • Linear story telling, in order to easily guide the audience through the data story, from the start to the end;
  • Filtering/selection/search, adding this features permit a more interactive and engaging user's experience;
  • Tacit tutorial, in order to have a more intuitive understanding for the audience without explicit step-by-step tutorial for the visualizations' instructions;
  • Caption/headlines, for contextualization of the paraghraps and the visualizations;
  • Introductory text, for a better explanation of the visuals and proper contextualization of the plots;
  • Summary/synthesis elements to tie together the narrative and provide a comprehensive overview of the visualizations/story.

5. Visualizations¶

For our data analysis, we primarily used Python along with its powerful libraries. We selected pandas for its superior functionality in data cleaning and preparation, which also facilitates initial data visualization. This was a critical step in comprehensively understanding the nuances of our dataset, ensuring it was properly prepared and optimized for creating the more refined and interactive visualizations in Flourish.

To delve deeper into the dataset and extract more specific insights, we used matplotlib and pyplot. These libraries helped us create small, informative plots that made complex data more accessible and easier to comprehend.

For the final presentation of our findings, we decided to use Flourish. Flourish is particularly well-suited for designing interactive charts and visualizations that enhance user engagement. Its interactivity features are ideal for embedding within websites, where viewers can explore data points in detail by interacting directly with the visual elements. This capability significantly enriches the storytelling aspect of our data, allowing users to engage with the information actively rather than passively consuming static images.

  • Explain the visualizations you've chosen.

5.1 Greenhouse Gas Emissions by Country (Section 3.1)¶

In our analysis of greenhouse gas emissions across European countries since 2000, we have chosen to present the data using an interactive choropleth map. Here are the reasons this visualization is particularly effective:

  • Geographic Context: Provides a clear visual representation of emissions across different countries, helping to understand regional variations and trends.
  • Interactive Exploration: Users can play the animation to see changes over the years, pause at any specific year, or hover over countries to get exact emissions values, which enhances user interaction and data accessibility.
  • Temporal Insights: The animation feature allows viewers to observe the progression of emissions reductions over time, offering insights into the effectiveness of environmental policies like the European Green Deal.
  • Detailed Comparison: Enables detailed comparison between countries by showing varying color intensities based on emission levels, which effectively highlights countries with higher or lower emissions.

This result not only informs but also engages the audience by allowing them to explore data at their own pace and interest, making complex information more accessible and understandable:

5.2 Share of Energy from Renewable Sources (Section 3.2)¶

For our analysis of the share of energy from renewable sources, we opted to present the information using a race chart. Here's why this choice enhances the understanding and engagement with the data:

  • Dynamic Visualization: Animates the yearly progression of each country's renewable energy share, making the data more engaging and easier to follow.
  • Comparative Insight: Allows viewers to instantly see how countries compare over time, highlighting leaders and those lagging behind in renewable energy adoption.
  • Interactive Engagement: Viewers can interact with the chart, exploring specific years and details, which promotes deeper engagement with the data.
  • Visual Storytelling: The race format adds a narrative element, showing the 'race' towards renewable energy goals, which helps convey the urgency and progress in a visually compelling manner.

The result is an interactive chart embedded below, providing a clear, dynamic, and engaging visualization of the data:

5.3 GDP and Trend Analysis (Section 3.3)¶

GDP and Trend Analysis (Section 3.3) In our exploration of GDP growth, we present the data using a line chart that includes both actual GDP values and a fitted trend line. This visualization method is chosen for several key reasons:

  • Direct Comparison: The line chart allows for the direct comparison of actual GDP data against the fitted trend line, clearly showing how actual values deviate from the general trend.
  • Interactive Data Exploration: Users can hover over the chart to see specific data points for each quarter, making it easy to identify exact GDP values and corresponding dates.
  • Trend Visualization: The trend line, based on a simple linear regression, provides a visual summary of the overall GDP growth direction over the analyzed period, highlighting whether it has been generally increasing, decreasing, or remaining stable.
  • Contextual Clarity: By including both data types in a single visualization, users gain a comprehensive view of the economic landscape, understanding both short-term fluctuations and long-term trends.

This interactive line chart not only informs but also engages the audience by enabling them to interact with the data to uncover deeper insights:

5.4 Energy Consumption and Production by Source (Section 3.4-3.5)¶

For our analysis of energy consumption and production in Denmark by different sources, we have chosen to use an interactive area chart. These visualizations effectively conveys the data for several reasons:

  • Layered Insight: The area chart stacks each energy source, allowing viewers to see the total energy consumption and production as well as the contribution of each source over time.
  • Interactive Details: Users can hover over any area in the chart to see specific data points, such as the year, consumption in terawatt-hours (TWh) or production in percentage for each energy source. This interactivity enhances user engagement by providing detailed information on demand.
  • Visual Comparison: The distinct areas for each energy source make it easy to compare how the consumption and production of different sources has evolved. Users can quickly identify trends, such as increases in renewable energy use or decreases in fossil fuels.
  • Contextual Clarity: Displaying the data in a cumulative format allows for a clear understanding of the relative proportions of each energy type within the total energetic landscape, highlighting shifts towards more sustainable sources or away from less sustainable ones.

These interactive visualizations not only provide comprehensive insights into Denmark's energy consumption and production patterns but also engage the audience, allowing them to explore data in a more meaningful way:

5.5 Greenhouse Gas Emissions (Section 3.5)¶

In our analysis of Denmark's greenhouse gas emissions from 2010 to 2021, we chose to use a simple line chart. This visualization method was selected for several reasons: Clarity and Simplicity: The line chart offers a straightforward representation of emissions data, making it easy for viewers to understand trends over time without the distraction of more complex visual elements. Direct Year-by-Year Observation: Users can hover over specific points on the line to see exact emissions values for each year, measured in 1,000 tonnes. This interactive feature provides detailed insight into annual changes and trends. Effective Trend Visualization: The line chart clearly shows the upward or downward trajectory of emissions, helping to quickly assess the impact of environmental policies and changes in Denmark. Focused Analysis: This type of chart is particularly effective for datasets like emissions where the main interest is in observing changes over time, rather than comparisons across multiple categories or variables.

This approach makes it straightforward to track Denmark’s progress in reducing greenhouse gas emissions and to evaluate the effectiveness of green initiatives over the specified period:

5.6 Air Quality (Section 3.6)¶

For our analysis of air quality trends in Denmark, specifically tracking PM10 levels, we chose to present the data using a line chart with an added trend line. This visualization is effective for several reasons: Clear Trend Visualization: The line chart with the trend line provides a visual representation of PM10 levels over time, clearly showing any overall trends and seasonal fluctuations. Interactive Data Points: The chart allows users to hover over specific points to see detailed PM10 values for each month and year, offering a precise and interactive way to examine the data. Assessment of Temporal Changes: The inclusion of a trend line helps highlight long-term improvements or deteriorations in air quality, making it easier to gauge the effectiveness of environmental policies. Seasonal Impact Insights: Fluctuations in the PM10 levels can help identify seasonal impacts on air quality, such as higher emissions during colder months due to increased heating.

This approach not only makes complex environmental data accessible and understandable but also engages the audience by providing them with the tools to actively explore trends and patterns:

5.7 CO2 Emissions Per Capita (Section 3.7)¶

In our analysis of CO2 emissions per capita, we have chosen a line chart to display and compare the trends for Denmark, Europe, and the world. This visualization method was selected for its ability to: Visual Comparison: Clearly differentiate and display the CO2 emissions per capita for Denmark, Europe, and the world, allowing for easy comparison across these categories. Temporal Trends: Illustrate the changes over time from 2000 to 2022, highlighting the effectiveness of policies and shifts towards sustainable practices. Interactive Detail: Enable users to hover over the chart to retrieve specific emissions data for each year in tonnes per capita, providing a detailed view of trends at a granular level. Benchmarking Insights: Facilitate a direct comparison of Denmark's progress in reducing CO2 emissions against broader averages, showing how national efforts align with or exceed regional and global trends.

This approach effectively conveys complex data in a straightforward manner, allowing viewers to engage with and digest significant environmental trends:

5.8 GDP Per Capita vs. Share of Renewable Energy (Section 3.8)¶

In our exploration of Denmark's economic performance alongside its environmental commitments, we opted to present the data using a double panel plot. This visualization strategy allows for a comprehensive comparison and includes several advantages:

  • Dual Metric Comparison: By displaying GDP per capita and the share of renewable energy in separate but adjacent plots, users can easily compare these two metrics over the same time period. This side-by-side layout helps in visualizing potential correlations between economic growth and renewable energy adoption.
  • Interactive Features: Each plot includes interactive elements where users can hover over data points to receive detailed information for each year. This interactivity enhances user engagement by allowing them to explore specific values of GDP and renewable energy percentages independently or simultaneously.
  • Focused or Comparative Analysis: Users have the flexibility to focus on a single metric or analyze both concurrently. This flexibility is particularly useful for users interested in specific aspects of Denmark's progress, such as economic data or energy statistics.
  • Visual Clarity and Insight: The charts are designed to clearly mark trends and shifts in both GDP and renewable energy shares. Users can visually discern periods of significant change, such as economic upturns or spikes in renewable energy usage, and consider how these may relate to each other.

This dual-plot approach not only makes the data accessible but also enables a deeper understanding of how Denmark’s economic policies align with its renewable energy initiatives:

5.9 Fossil Fuel Share vs Total Energy Consumed¶

In our analysis of Denmark's energy landscape we have chosen to employ a double panel plot to effectively present the data. This visualization method offers several advantages for understanding the dynamics between the share of fossil fuels and total energy consumption over time:

  • Dual Metric Comparison: Utilizing separate but adjacent plots for the share of fossil fuels and total energy consumption allows users to compare these two critical metrics across the same timeline. This setup facilitates the examination of the relationship between the decline in fossil fuel usage and the overall energy consumption trends in Denmark.
  • Interactive Features: Interactive elements embedded within each plot enable users to hover over data points, accessing detailed information for each year. This feature empowers users to explore specific values of fossil fuel share and total energy consumption independently or in tandem, fostering a deeper understanding of the evolving energy landscape.
  • Focused or Comparative Analysis: Users have the flexibility to focus on either the declining trend of fossil fuel usage or the broader context of total energy consumption. This adaptability caters to users with varying interests, whether they are studying the environmental impact of fossil fuels or analyzing Denmark's overall energy consumption patterns.

By employing this dual-plot approach, we aim to provide users with a comprehensive and insightful perspective on how Denmark's energy policies are driving a transition towards cleaner and more sustainable energy sources, while simultaneously managing overall energy demand. This visualization not only enhances accessibility to the data but also facilitates a deeper understanding of Denmark's energy landscape and its implications for environmental sustainability.

Conclusion of Visualizations¶

Our visualizations are carefully designed to enhance the storytelling of Denmark's leadership in sustainability, focusing on clear, interactive, and user-friendly designs. By utilizing straightforward plots like race charts, line charts, and area charts, we ensure that the data is accessible and engaging for all users, regardless of their expertise in data interpretation. This approach not only facilitates easy comprehension of complex data but also actively involves the viewer through interactive features, making it easier to grasp the impact and effectiveness of Denmark’s environmental strategies. Through these visual tools, we aim to convey a compelling narrative that highlights sustainable progress and inspires further action.

  • Why are they right for the story you want to tell?

The visualizations selected align perfectly with the narrative of Denmark’s sustainability efforts, emphasizing its leadership and contextualizing its achievements within Europe. Race chart vividly demonstrate Denmark’s leadership in renewable energy adoption compared to other European countries. Stacked line charts allow viewers to trace the evolution of energy sources over time, showcasing the nation’s transition towards sustainable solutions. Side-by-side line facilitate direct comparisons between Denmark’s economic growth and its renewable energy investments, highlighting potential correlations. Moreover, an interactive map of Europe displaying per capita greenhouse gas emissions provides a broader context for Denmark's environmental performance, making it easy to compare with its neighbors. These visual tools are chosen for their ability to make complex data accessible and engaging, effectively conveying the critical aspects of Denmark's environmental strategies.

6. Discussion¶

  • What went well?

We believe that the entire team was quite invested in this project. We are all very satisfied and proud of the end result. We were able to quickly divide the tasks among each other and help each other out when someone was in doubt about something.

  • What is still missing? What could be improved? Why?

We believe that minor adjustments could enhance our plots. Specifically, navigating Flourish proved more challenging than anticipated, making it difficult to configure the popups precisely as we wanted. Despite this, the required tweaks to perfect our visualizations are minimal. We are highly satisfied with the overall website and the analysis we have provided. With additional time, we could further enrich our data story by gathering more comprehensive evidence to support our project. Nevertheless, we are proud of what we have accomplished and hope you appreciate the end result as much as we do.

7. Contributions¶

Throughout the project, each team member contributed to all aspects of the work, incouraging a comprehensive understanding and unanimous agreement on the final outcome. While certain tasks were naturally more aligned with the academic background of each individual team member, it is important to emphasize that every component went thorough review and gained accaptance by everyone.

8. References¶

  1. Narrative Visualization: Telling Stories with Data (http://vis.stanford.edu/files/2010-Narrative-InfoVis.pdf)
  2. CO₂ and Greenhouse Gas Emissions (https://ourworldindata.org/co2-and-greenhouse-gas-emissions)
  3. Production, value added and exports in the environmental goods and services sector (https://ec.europa.eu/eurostat/databrowser/view/env_ac_egss2/default/table?lang=en&category=cli.cli_mit.cli_mit__)
  4. What are the safest and cleanest sources of energy? (https://ourworldindata.org/safest-sources-of-energy)